#!/bin/bash


#shell 里的头等公民是 字符串 和 数组<字符串>
#echo hi sss : ////: dsdsd
string_length=bin_zhou_xue_yuan
echo name : ${string_length}
echo 'name : ${string_length}'
echo length:  ${#string_length}

students=(zhangsan lisi wangwu)
echo ${students[*]} length is : ${#students[*]}

#字符串转数组 split
persons="zhangsan lisi wangwu"
array_persons=(${persons})
echo string_persons length : ${#persons}
echo array_persons length : ${#array_persons[*]}

persons="zhangsan:lisi:wangwu"
#replace
echo ${persons//:/====}
array_persons=(${persons//:/ })
echo string_persons length : ${#persons}
echo ${array_persons[*]}
echo array_persons length : ${#array_persons[*]}
echo ${array_persons[0]}
echo ${array_persons[2]}

# substring
echo ${persons:2:4}






